<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <!--bootstrap插件-->
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <link href="/static/plugin/bootstrap/bootstrap-3.3.7-dist/css/bootstrap.min.css" rel="stylesheet"/>
    <link href="/static/plugin/jo/joUI.css" rel="stylesheet"/>
    <!--字体插件-->
    <link href="/static/plugin/font-awesome-4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
    <link href="/static/plugin/layui-2.4.3/css/layui.css" rel="stylesheet"/>
    <!--ztree-->
    <link href="/static/plugin/zTree/css/metroStyle/metroStyle.css" rel="stylesheet"/>
    <!--common-->
    <link href="/static/css/common.css" rel="stylesheet"/>
    <title>指标视图</title>
</head>
<body class="skin-default">

<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
    <div class="row">
        <div class="col-xs-12">
            <!--视图块-->
            <div class="container-fluid card">
                <div class="row">
                    <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
                        <!--检索栏-->
                        <form class="form-inline search-bar" id="pageForm">
                            <!--<div class="form-group">-->
                                <!--<label class="control-label">样品编码：&nbsp;</label>-->
                                <!--<input type="text" name="sampleNumber" class="form-control">-->
                            <!--</div>-->
                            <div class="form-group" style="float: left">
                                <label class="control-label" style="float: left">指标类型：&nbsp;</label>
                                <select style="width: 120px" name="indicatorType" id="indicatorType"
                                        class="joSelect form-control" data=''
                                        firstItem='{"indicatorId":"","indicatorsName":""}'
                                        dataurl="" keyfield="indicatorId" valuefield="indicatorsName"></select>
                            </div>
                            <div class="form-group" style="float: left;border: 1px;">
                                <label class="control-label" style="float: left">指标名称：&nbsp;</label>
                                <select style="width: 120px" name="indicators" id="indicators"
                                        class="joSelect form-control" data=''
                                        firstItem='{"indicatorId":"","indicatorsName":""}' dataurl=""
                                        keyfield="indicatorId" valuefield="indicatorsName"></select>
                            </div>
                            <button type="button" class="btn btn-primary" onclick="joView.select()"><i
                                    class="fa fa-search" aria-hidden="true"></i>&nbsp;查询
                            </button>
                        </form>
                        <!--/检索栏-->
                    </div>
                </div>
                <div class="row">
                    <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
                        <!--按钮栏-->
                        <div class="form-group button-bar">
                            <!--按钮占位符.加载到的按钮会渲染到占位符里面-->
                            <span class="young-button-placeholder" navigateId="DFJC_BUTTON"></span>
                            <span class="young-button-placeholder" navigateId="NAV_TYPE_HTML_BUTTON"></span>
                            <span class="young-button-placeholder" navigateId="DFJC_LOCK_BUTTON"></span>
                        </div>
                        <!--/按钮栏-->
                    </div>
                </div>
                <div class="row">
                    <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
                        <div class="table-bar">
                            <!--grid-->
                            <div class="table-responsive">
                                <table class="table table-bordered table-hover" id="mainList"
                                       dataUrl="/nyd/landMonitoringindex/getPage"
                                       lockUrl="/nyd/landMonitoringindex/lock"
                                       unlockUrl="/nyd/landMonitoringindex/unlock"
                                       deleteUrl="/nyd/landMonitoringindex/delete"
                                       formUrl="/page/nyd/landMonitoringindexForm.html">
                                    <!--  <col field="id" title="ID" width="15%" align="" event="click" />-->
                                    <col field="indicatorName" title="指标" width="15%" align="" event="click"/>
                                    <col field="sampleNumber" title="样品编码" width="15%" align="" />
                                    <col field="indicatorTypeName" title="指标类型" width="15%" align=""/>

                                    <col field="detectValues" title="检测值" width="15%" align=""/>
                                    <col field="detectCompany" title="检测单位" width="15%" align=""/>
                                    <col field="detectMethod" title="检测方法" width="15%" align=""/>
                                    <col field="detectRemarks" title="指标备注" width="15%" align=""/>
                                    <col field="levels" title="环境质量等级" width="15%" align=""/>
                                    <col field="unit" title="单位" width="15%" align=""/>
                                    <col field="[=jo.formatDate('{detectTimes}')]" title="检测时间" width="11%" align=""/>
                                    <col field="qualityremarks" title="环境质量备注" width="15%" align=""/>
                                    <col field="detectUnlack" title="锁定" width="8%" align=""/>
                                    <col field="_opt1" title="查看" width="10.1%" align="" event="click"/>
                                </table>
                            </div>
                            <!--/grid-->

                            <!--分页条-->
                            <div class="page-bar" gridId="mainList">

                            </div>
                            <!--/分页条-->
                        </div>
                    </div>
                </div>
            </div>

        </div>
    </div>
</div>

<!--配置信息-->
<script src="/static/js/config.js"></script>
<!--jquery-->
<script src="/static/plugin/jquery/jquery-3.3.1.js"></script>
<script src="/static/plugin/jquery/jquery.cookie.js"></script>
<!--bootstrap-->
<script src="/static/plugin/bootstrap/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
<!--[if lt IE 9]>
<script src="/static/plugin/other/html5shiv.js"></script>
<script src="/static/plugin/other/respond.min.js"></script>
<![endif]-->
<!--layui-->
<script src="/static/plugin/layui-2.4.3/layui.all.js"></script>
<!--ztree-->
<script src="/static/plugin/zTree/js/jquery.ztree.all.js"></script>
<!--common-->
<script src="/static/js/common.js"></script>
<!--jo-->
<script src="/static/plugin/jo/jo.js"></script>
<script src="/static/plugin/jo/jo-adapt.js"></script>
<script src="/static/plugin/jo/jo-page-view.js"></script>
<script src="/static/plugin/jo/jo-page-form.js"></script>
<script src="/static/plugin/jo/jo-listener.js"></script>
<script type="text/javascript">
    layui.laydate.render({
        elem: '#detectTimes' //注册日期控件
    });
    layui.laydate.render({
        elem: '#detectTimes2' //注册日期控件
    });
    $(function () {
        initIndicator('indicatorType', 'indicators');
        initButton();
        joView.init({
            grid: $("#mainList"),
            PKName: "id",
            condition: {sampleNumber: jo.getUrlParam('sampleNumber')},
            transferParam: 'sampleNumber=' + jo.getUrlParam('sampleNumber')
        });//初始化页面
    });
    //表格渲染时行处理,参数1为当前行的数据对象,参数2为当前行的索引值(最小为0)
    joView.handleItem = function (oItem, iIndex) {
        oItem.detectUnlack = formatUnlack(oItem.detectUnlack);
        oItem._opt1 = '<button type="button" class="btn btn-sm btn-outline btn-primary" >&nbsp;详细信息</button>'
    };

    //格式化锁定状态
    function formatUnlack(detectUnlack) {
        if (detectUnlack == 0) {
            return '<span class="label label-primary">未锁定</span>';
        } else {
            return '<span class="label label-danger">锁定</span>';
        }
    }

    //表格渲染完成后的回调,参数为表格数据(数组对象)
    joView.setGridDataAfter = function (oList) {

    };

    //导出
    function exportConfig() {
        var ids = jo.getCheckBoxValue("id");
        if (!ids) {
            jo.confirm("确定要导出全部吗？", function (index) {
                jo.post("/nyd/landMonitoringindex/export", {ids: ids});
                layer.close(index);
            });

        } else {
            jo.confirm("确定要导出选中的数据吗？", function (index) {
                jo.post("/nyd/landMonitoringindex/export", {ids: ids});
                layer.close(index);
            });
        }
    }

    /* 关于joView更多回调函数和配置参数可查看jo-page-view.js */
</script>
</body>
</html>
